package com.wangjie.pattern.singleton;

/**
 * 饿汉式(静态常量/静态代码块)
 *
 * 构造器私有(防止new)
 * 类的内部创建对象
 * 向外暴露一个静态的公共方法提供访问
 */
public class Singleton1 {
    private static Singleton1 instance;
    // private static Singleton1 instance = new Singleton1();

    static {
        instance = new Singleton1();
    }

    private Singleton1() {

    }

    public static Singleton1 getInstance() {
        return instance;
    }
}